#include "renderthreadbase.h"

RenderThreadBase::RenderThreadBase(QObject *parent): QThread(parent) {}

void RenderThreadBase::start()
{
    QThread::start(HighestPriority);
    isPause = false;
}

void RenderThreadBase::pause(bool is_pause)
{
    isPause = is_pause;
}

void RenderThreadBase::exit()
{
    isRun = false;
    // 等待线程退出
    while (this->isRunning()) {
        usleep(1000000/100);
    }
    quit();
}

void RenderThreadBase::render()
{
    // 线程执行代码
    usleep(10);
    if(isPause) return;
}

void RenderThreadBase::run()
{
    while (isRun)
    {
        render();
    }
}
